
import {loadFromLocal,saveToLocal} from '../common/util/storage'
import {INITIAL_TAB_INDEX_KEY} from '../../config/index'


export function getInitialTabIndexFromLocalStorage(sellerId) {
  console.log('进入getInitialTabIndexFromLocalStorage')
  console.log("sellerId:")
  console.log(sellerId)

  const indexKey = INITIAL_TAB_INDEX_KEY
  // 默认取第一个页签码
  let indexValue = loadFromLocal(sellerId,indexKey,0)

  // 若取不到初始页面，则返回默认值0，表示第一个页面
  if(!indexValue)
    indexValue = 0
  console.log('indexValue:')
  console.log(indexValue)
  return indexValue
}

export function setInitialTabIndexToLocalStorage(sellerId,tabIndex) {
  console.log('进入setInitialTabIndexFromLocalStorage')
  console.log("sellerId:")
  console.log(sellerId)
  console.log('tabIndex:')
  console.log(tabIndex)

  const indexKey = INITIAL_TAB_INDEX_KEY
  saveToLocal(sellerId,indexKey,tabIndex)
}